//
//  FirstViewController.m
//  MainDemo
//
//  Created by FM on 2017/1/9.
//  Copyright © 2017年 FM. All rights reserved.
//

#import "FirstViewController.h"
#import "PhotoPickController.h"
#import "CustomVideoPlay.h"
@interface FirstViewController ()<PhotoPickDelegate>
{
    CustomVideoPlay *player;
    
}
@property (nonatomic ,assign) BOOL  isShowStatusBar;
@end

@implementation FirstViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor=[UIColor orangeColor];
    UIButton *btn=[[UIButton alloc]init];
    btn.frame=CGRectMake(100, 100, 80, 30);
    [btn addTarget:self action:@selector(tap) forControlEvents:UIControlEventTouchUpInside];
   
    [btn setTitle:@"选择照片" forState:UIControlStateNormal];
    [self.view addSubview:btn];
     self.isShowStatusBar=[UIApplication sharedApplication].statusBarHidden;
    UIButton *btn1=[[UIButton alloc]init];
    btn1.frame=CGRectMake(100, 250, 80, 30);
    [btn1 addTarget:self action:@selector(clickCreatVideo) forControlEvents:UIControlEventTouchUpInside];
    
    [btn1 setTitle:@"播放视频" forState:UIControlStateNormal];
    [self.view addSubview:btn1];
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(fullScreen) name:@"fullScreen" object:nil];
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(smallScreen) name:@"smallScreen" object:nil];
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(closeScreen) name:@"close" object:nil];
}
- (BOOL)prefersStatusBarHidden
{
    return self.isShowStatusBar;
}
-(void)closeScreen{

}
-(void)fullScreen{
    
    self.isShowStatusBar=YES;
    
    [self setNeedsStatusBarAppearanceUpdate];
    
}
-(void)smallScreen{
    
    
    self.isShowStatusBar=NO;
    [self setNeedsStatusBarAppearanceUpdate];
}
-(void)clickCreatVideo{
    
    player = [[CustomVideoPlay alloc]initWithFrame:CGRectMake(0, 84, WIDTH, kPercenX_scale(230)) andAddOnView: self.view];
    player.contentMode=UIViewContentModeScaleAspectFit;
    player.videoUrlStr = @"http://images.baseuser.cn/VID_20170825_162834.mp4";//@"http://player.youku.com/embed/XMjk5MTgwMTI2MA";//@"http://images.baseuser.cn/VID_20170825_162834.mp4";//@"http://baobab.wdjcdn.com/1455782903700jy.mp4";
  
}
-(void)tap{
    int moreThanCount          = 9;//允许选择的图片数量
    PhotoPickController *photoImageVC=[[PhotoPickController alloc]init];
    photoImageVC.delegate=self;
    //[photoImageVC setHidesBottomBarWhenPushed:YES];
    // photoImageVC.oldImgArray   = dataArray;
    photoImageVC.moreThanIndex = moreThanCount;
    [self.navigationController pushViewController:photoImageVC animated:YES];
}
-(void)sendPhotoImages:(NSArray *)images;{
    
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
